package co.fitstart.weapp.api.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.demo2do.core.persistence.GenericDaoSupport;
import com.demo2do.core.persistence.annotation.Dao;

import co.fitstart.entity.coach.CoachStudentRelation;
import co.fitstart.entity.course.CourseType;
import co.fitstart.entity.principal.Principal;
import co.fitstart.weapp.api.dao.CoachCourseDao;
import co.fitstart.weapp.api.service.CoachCourseService;
@Service("coachCourseService")
public class CoachCourseServiceImpl implements CoachCourseService {
	
	@Dao
	private CoachCourseDao coachCourseDao;
	
	@Autowired
	private GenericDaoSupport genericDaoSupport;

	/*
	 * (non-Javadoc)
	 * @see co.fitstart.weapp.api.service.CoachCourseService#list(co.fitstart.entity.principal.Principal, java.lang.String)
	 */
	@Override
	public List<CoachStudentRelation> list(Principal coach, String courseType1) {
		CourseType courseType=CourseType.aliasOf(courseType1);
		return coachCourseDao.list(coach, courseType);
	}

	/*
	 * (non-Javadoc)
	 * @see co.fitstart.weapp.api.service.CoachCourseService#load(java.lang.Long)
	 */
	@Override
	public CoachStudentRelation load(Long coachStudentId) {
		return genericDaoSupport.load(CoachStudentRelation.class, coachStudentId);
	}

}
